package com.apes.autoparts.product.repository;

import com.apes.autoparts.product.model.BrandProduct;
import com.apes.framework.jpa.repository.CustomRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.Map;
import java.util.Set;

/**
 * 类描述：
 *
 * @ClassName brandProductRepository
 * @Description 描述
 * @Author wushilong
 * @Date 2022/10/9 11:37
 * @Version 1.0
 */
public interface BrandProductRepository extends CustomRepository<BrandProduct, String> {

    @Query(value = "select b.id as id, b.name, b.brand, b.brandMark from BrandProduct b where b.brand = :brand and b.brandMark = :brandMark")
    Map<String, String> queryByCondition(@Param("brand") String brand, @Param("brandMark") String brandMark);


    @Query(value = "select a.id as id from BrandProduct a")
    Set<String> findAllId();

    BrandProduct findByBrandAndBrandMark(String brand, String brandMark);
}
